<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page errorPage="ExceptionHandler.jsp" %>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ page import="static org.six11.olive3.server.WebActionServlet.*"%>
<%@ page import="javax.naming.Context" %>
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="javax.naming.NamingException" %>
<%@ page import="org.six11.olive3.server.DrillData" %>
<%@ page import="org.six11.olive3.server.DatabaseThing" %>
<%@ page import="javax.sql.DataSource" %>
<%@ page import="java.util.Collection" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Sketching Games: Picturephone</title>
<link rel="stylesheet" href="css/style.css" TYPE="text/css">

<% 
	Context env = (Context) new InitialContext().lookup("java:comp/env");
  	DatabaseThing dbThing = new DatabaseThing((DataSource) env.lookup("jdbc/sketching_games"));
  	Collection<DrillData> recentSketches = DrillData.getRecentSketches(dbThing);
    request.setAttribute("sketches", recentSketches);
%>
</head>

<body onload="document.forms['login'].user.focus()">

<jsp:include page="nav.jsp" />
<table cellpadding="20" style="width: 100%">
	<tr>
		<td>
		<div class="head">Picturephone!</div>
		</td>
		<td align="right">
		<c:forEach items="${sketches}" var="s">
		<a class="toggleborder" href="<%=WEB_ACTION_SHORT%>?<%=PARAM_ACTION%>=<%=ACTION_BROWSE%>&AMP;<%=PARAM_SKETCH_ID%>=${s.id}"><img src="${s.smallPngUrl}" /></a>
		</c:forEach>
		<br />
		<a href="<%=WEB_ACTION_SHORT%>?action=<%=ACTION_BROWSE%>">(More...)</a>
		</td>
	</tr>
</table>
<table>
	<tr>
		<td>
		<div class="prose">
		
		<p>Picturephone is an online game where you make and describe
		drawings. It is sort of like <i>telephone</i>, where people take turns
		whispering a message to the person to their left. By the time the
		message gets back to the first person, it has usually changed a lot
		and can be pretty funny. Unlike telephone, Picturephone is played by
		alternately drawing and writing.</p>

		<p>There are three parts to the game. First, you'll be given a
		text description, and your job is to make a sketch that captures the
		essence of the description as much as possible. The next part is the
		reverse---you're given a sketch, and your job is to write the best
		description you can.</p>

		<p>The last part of the game is judging other people's work (no,
		you don't get to judge your own stuff!). The better two sketches
		match, the more points you should give them. This is why it is
		important to get the details right when you are sketching or
		describing.</p>
		
		<p>
			<a style="font-weight: bold; color: #700"
			href="guidelines.jsp">Click here for
			instructions on what to do. It's easy, I
			promise!</a>
		</p>

		<a style="font-weight: bold; color: #700"
		href="about.jsp">Wondering why I made this?</a>

		
		</div>
		</td>
		<td bgcolor="#e0e0e0" style="width: 300px">
			<center>
				<jsp:include page="loginBox.jsp"></jsp:include>
			</center>
		</td>
	</tr>
</table>

</body>
</html>
